class Solution(object):

    def subarraySum(self, nums, k):
        """
        :type nums: List[int]
        :type k: int
        :rtype: int
        """
        sum , count = 0 , 0
        sums = list()
        for num in  range(0 , len(nums)):
            if nums[num] == k:
                count=count+1
            for i in range(0 , len(sums)):
                sums[i]=sums[i]+nums[num]
                if sums[i] == k:
                    count=count+1
            sums.append(nums[num])
        return count
        

                

s = Solution()
s.subarraySum([1,1,1] , 2)